use std::pin::Pin;
use std::task::{Context, Poll};

pub trait DoAsync {
    type out ;
    fn my_do_future(&mut self,
                       context: &mut Context)->Poll<Self::out>;
}

impl <T,T2>DoAsync for Pin<Box<T>> where T:Future<Output=T2>+Sized,T2:Sized
{
    type out = T2;

    fn my_do_future(&mut self, context: &mut Context) -> Poll<T2> {
        match Future::poll(self.as_mut(), context) {
            Poll::Ready(i) => Poll::Ready(i),
            Poll::Pending => {
                println!("pending");
                Poll::Pending
            }
        }
    }
}
